﻿@inherits AdminCompontentBase

<SSheetDialog EnableDomReload @bind-Value=_visible Title="@T("Add Api Permission")">
    <MCard class="pt-9 d-flex flex-column full-height" Style="margin-left:228px;margin-right:228px;">
        <MCardText Class="full-height">
            <MForm Model=_apiPermissionDetailDto EnableI18n EnableValidation @ref="_form">
                <MRow>
                    <MCol Md=12>
                        <DccI18nConfiger @bind-Name="_apiPermissionDetailDto.Name" />
                    </MCol>
                    <MCol Md=12>
                        <STextField Label="@T("Code")" Required Prefix="@($"{_apiPermissionDetailDto.AppId}.")" Class="permission-code" @bind-Value="_apiPermissionDetailDto.Code" Messages='new List<string>{T("PermissionCodeMsg")}' />
                    </MCol>
                    <MCol Md=12>
                        <SSelect @bind-Value="_apiPermissionDetailDto.Type" Required
                            Label="@T("Type")"
                            Items="@_apiPermissionTypes"
                            ItemText="u => u.Text"
                            ItemValue="u => u.Value">
                        </SSelect>
                    </MCol>
                    <MCol Md=6>
                        <STextField Prefix="@_showUrlPrefix" Label="@T("URL")" @bind-Value="_apiPermissionDetailDto.Url" />
                    </MCol>
                    <MCol Md=6>
                        <SNumberTextField Label="@T("Order")" @bind-Value="_apiPermissionDetailDto.Order" />
                    </MCol>
                    <MCol Md=12>
                        <STextarea Label="@T("Description")" @bind-Value="_apiPermissionDetailDto.Description" Height="120" NoResize HideDetails="@("auto")" />
                    </MCol>
                </MRow>
            </MForm>
        </MCardText>
        <MCardActions class="d-flex align-center mb-12 px-6">
            <MSpacer />
            <SButton Medium OnClick="OnSubmitHandler">@T("Submit")</SButton>
        </MCardActions>
    </MCard>
</SSheetDialog>
